package com.zhuss.controller.core;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.bean.bo.core.book.DetailBookBo;
import com.zhuss.bean.bo.core.book.SearchBookBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.ReadService;
import com.zhuss.core.book.BookReadServiceExt;
import com.zhuss.core.processor.BookRead;
import com.zhuss.exception.AabException;


/**
 * 书籍查询 controller
 * @Author zhushanshuo
   @Date 2019-11-27 19:58
 *
 */
  
 
@RestController
@RequestMapping("/book")
public class BookReadController extends BaseController {
	
	@Autowired
	@Qualifier("bookReadService")
	private ReadService<Object, Object> bookReadService;
	
	@Autowired
	@Qualifier("bookReadServiceExt")
	private BookReadServiceExt bookReadServiceExt;
	
	
	@Autowired
	private BookRead bookRead;
	
	/**
	 * 详情
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
	@RequestMapping("/detail")
    public Object detail(@RequestBody DetailBookBo bo) throws AabException {
		
		Object result = bookReadService.detail(bo);
		return result;
    }
	
	/**
	 * 列表
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
    @RequestMapping("/list")
    public Object list(@RequestBody SearchBookBo bo) throws AabException {
		
		Object result = bookReadService.list(bo);
		return result;
    }
	
	@ResponseBody
    @RequestMapping("/listAll")
	public Object listAll() throws AabException {
		Object result = bookReadServiceExt.listAll();
		return result;
	}
	
}
